//
//  GDWaterDetailViewController.m
//  Gunterapple
//
//  Created by 热带雨林 on 2021/2/2.
//  Copyright © 2021 热带雨林. All rights reserved.
//

#import "GDWaterDetailViewController.h"
#import "armImageModel.h"

@interface GDWaterDetailViewController ()
@property (nonatomic, strong) UIImageView *topImageView;
@property (nonatomic, strong) UIView *informaBackView;
@property (nonatomic, strong) UIStackView *informationView;
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UILabel *descLabel;

@end

@implementation GDWaterDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    self.view.backgroundColor = NormalColor;
    self.view.backgroundColor = [UIColor whiteColor];
    self.topImageView = [[UIImageView alloc]initWithFrame:CGRectZero];
    [self.view addSubview:self.topImageView];
    self.topImageView.image = [UIImage imageNamed:self.model.name];
    self.topImageView.layer.cornerRadius = 10.0f;
    self.topImageView.layer.masksToBounds = YES;
    self.topImageView.contentMode = UIViewContentModeScaleAspectFill;
    self.topImageView.clipsToBounds = YES;
    [self.topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(SJHeight + 10);
        make.left.equalTo(self.view).offset(10);
        make.width.mas_equalTo(GDScreenW - 20);
        make.height.mas_equalTo(GDScreenW / 2 + 50);
    }];
    
    self.informaBackView = [[UIView alloc]initWithFrame:CGRectZero];
    [self.view addSubview:self.informaBackView];
    self.informaBackView.backgroundColor = NormalColor;
    self.informaBackView.layer.cornerRadius = 10.0f;
    self.informaBackView.layer.masksToBounds = YES;
    [self.informaBackView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.topImageView.mas_bottom).offset(5);
        make.left.equalTo(self.topImageView);
        make.width.mas_equalTo(GDScreenW - 200);
        make.height.mas_equalTo(GDScreenW - 200);
    }];

    self.nameLabel = [[UILabel alloc]init];
    self.nameLabel.font = [UIFont fontWithName:Helvetica size:25];
    self.nameLabel.text = self.model.title;
    self.nameLabel.numberOfLines = 0;
    self.nameLabel.textColor = [UIColor whiteColor];
    
    self.descLabel = [[UILabel alloc]init];
    self.descLabel.font = [UIFont systemFontOfSize:13];
    self.descLabel.text = @"this is a normal title,do not care this information!";
    self.descLabel.numberOfLines = 0;
    self.descLabel.textColor = [UIColor whiteColor];
    
    self.informationView = [[UIStackView alloc]initWithArrangedSubviews:@[self.nameLabel,self.descLabel]];
    [self.informaBackView addSubview:self.informationView];
    self.informationView.spacing = 5;
    self.informationView.axis = UILayoutConstraintAxisVertical;
    self.informationView.distribution = UIStackViewDistributionFillEqually;
    self.informationView.alignment = UIStackViewAlignmentFill;
//    UIEdgeInsets padding = UIEdgeInsetsMake(5, 10, 100, 10);
    [self.informationView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.edges.equalTo(self.informaBackView).insets(padding);
        make.top.left.equalTo(self.informaBackView).offset(10);
        make.size.mas_equalTo(CGSizeMake(GDScreenW - 200, (GDScreenW - 200) / 2));
    }];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
